import tkinter as tk
window = tk.Tk()
window.title('my window')
window.geometry('400x400')
l = tk.Label(window, bg='yellow', width=20, text='empty')
l.pack()


def print_selection(v):
    l.config(text='you have selected' + v)  # Label中加内容用这


s = tk.Scale(window, label='try me', from_=5, to=11, orient=tk.HORIZONTAL, length=200, showvalue=1, tickinterval=3, resolution=0.01, command=print_selection)
# label：尺度名，from,to为范围，orient：确定方向的横向，length为它在屏幕上显示多长（像素），showvalue代表是否显示数字0为不显示，1为显示，
# tickinterval标签的单位长度，resolution为保留小数位数0.01为两位小数，
s.pack()
window.mainloop()
